home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
texts
/
addsrchg.lha
/
AddSearchGuide.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1996-04-30
|
2KB
|
78 lines
/*
$VER: AddSearchGuide.rexx 1.0 (30.4.96)
by Remco van Hooff (rvhooff@globalxs.nl)
Idea and suggestions by Neil Bothwick (neil@wirenet.u-net.com)
*/
PARSE ARG input
IF (input = '' | input = '?') THEN DO
SAY 'FILE/K,REQ/S'
EXIT
END
IF UPPER(input) = 'REQ' then req = 1 /* use rexxreqtools requester */
ELSE req = 0
IF req = 1 THEN DO
IF ~SHOW('L','rexxreqtools.library') THEN CALL ADDLIB('rexxreqtools.library',0,-30,0)
IF ~SHOW('L','rexxreqtools.library') THEN SAY 'Couldn''t open rexxreqtools.library'
CALL RTFILEREQUEST(,,'Select AmigaGuide files',,'rtfi_matchpat=#?.guide rtfi_flags = freqf_patgad|freqf_multiselect',inlist)
IF inlist = 0 THEN EXIT
END
IF ~SHOW('L','rexxsupport.library') THEN CALL ADDLIB('rexxsupport.library',0,-30,0)
IF ~SHOW('L','rexxsupport.library') THEN SAY 'Couldn''t open rexxsupport.library'
IF req = 0 THEN DO
IF ~EXISTS(input) THEN DO
SAY 'Input file not found!'
EXIT
END
inlist.1 = input
inlist.count = 1
output = inlist.1'.tmp'
END
DO i = 1 to inlist.count
SAY 'Working on: "'inlist.i'"'
output = inlist.i'.tmp'
CALL OPEN(in,inlist.i,'r')
line = READLN(in)
IF POS('DATABASE', UPPER(line)) = 0 THEN DO
SAY 'This isn''t an AmigaGuide document.'
CALL CLOSE(in)
ITERATE i
END
CALL OPEN(out,output,'w')
DO UNTIL (POS('@NODE', UPPER(line)) ~= 0 & POS('MAIN', UPPER(line)) ~= 0)
WRITELN(out, line)
line = READLN(in)
END
WRITELN(out, line)
line = READLN(in)
IF POS('SearchGuide', line) = 0 THEN DO
WRITELN(out, '@{" Search " SYSTEM "RUN SearchGuide 'input'"}')
WRITELN(out, line)
DO UNTIL EOF(in)
rest = readch(in, 1048576) /* 1MB should be enough :.) */
WRITECH(out, rest)
END
END
ELSE DO
SAY 'Skipping, search button already added.'
CALL CLOSE(out)
CALL CLOSE(in)
DELETE(inlist.i'.tmp')
ITERATE i
END
CALL CLOSE(out)
CALL CLOSE(in)
DELETE(inlist.i)
RENAME(inlist.i'.tmp',inlist.i)
END
SAY 'Done.'
EXIT